/*
 * Autor.cpp
 *
 *  Created on: Oct 9, 2012
 *      Author: romina
 */

#include "Autor.h"


Autor::Autor(string apellido, string nombre) {
	this->apellido = apellido;
	this->nombre = "nn";
	if (nombre.empty())
		this->nombre = "nn";

}

int Autor::getTamanio(){
	return this->apellido.length() + this->nombre.length();
}

string Autor::getApellido(){
	return this->apellido;
}

string Autor::getNombre(){
	return this->nombre;
}

string Autor::toString(){
	return this->apellido + "|" + this->nombre;
}

void Autor::serializar(char * buffer, unsigned int &offset){

	Persistor::transformar_cadena_en_char(buffer, offset, (char*)this->apellido.c_str());
	Persistor::transformar_cadena_en_char(buffer, offset, (char*)this->nombre.c_str());
}

void Autor::deserializar(char * buffer, unsigned int &offset){

	this->apellido = Persistor::obtener_cadena_desde_Buffer(buffer, offset);
	this->nombre = Persistor::obtener_cadena_desde_Buffer(buffer, offset);
}

Autor::~Autor() {
	// TODO Auto-generated destructor stub
}

